<template>
  <div class="panel">
    <div class="panel-header">
      <div style="display: flex; flex-grow: 1">
        <img :src="titleBgIcon" alt="" pl-16 pr-10/>
        <span>{{ title }}</span>
        <img :src="titleDecoration" alt="" ml-10/>
      </div>
      <slot name="opt"></slot>
    </div>
    <div class="panel-body">
      <CustomLoading v-if="loading" />
      <div class="line line-top"></div>
      <div class="line line-right"></div>
      <div class="line line-bottom"></div>
      <div class="line line-left"></div>
      <slot></slot>
    </div>
  </div>
</template>

<script setup>
import CustomLoading from "../custom-loading";
import titleBgIcon from "@/assets/image/title_bg_icon.png";
import titleDecoration from "@/assets/image/title_decoration.png";

defineProps({
  title: {
    type: String,
    default: "标题",
  },
  loading: {
    type: Boolean,
    default: false,
  },
});
</script>

<style lang="scss" scoped>
.panel {
  display: flex;
  flex-direction: column;
}
.panel-header {
  position: relative;
  height: 40.3px;
  background-image: url("@/assets/image/title_bg.png");
  background-repeat: no-repeat;
  background-size: 100% 100%;
  display: flex;
  justify-content: space-between;
  padding: 0px 10px 0px 0px;
  align-items: flex-start;
  span {
    font-family: SourceHanSansCN-Bold;
    font-weight: 600;
    font-size: 24px;
    color: #ffffff;
    // margin-top: -6px;
    text-shadow: 0 0 7px #2c69ff;
  }
  img {
    width: 30px;
    height: 30px;
  }
}
.panel-body {
  position: relative;
  flex: 1;
  height: 0px;
  margin-top: 8px;
  // padding: 12px;
  box-sizing: border-box;
  background-color: rgba($color: #002c65, $alpha: 0.25);
  .line {
    position: absolute;
    &-top {
      left: 0px;
      top: 0px;
      width: 100%;
      height: 1px;
      background-color: rgba($color: #93c7ff, $alpha: 0.25);
    }
    &-bottom {
      left: 0px;
      bottom: 0px;
      width: 100%;
      height: 1px;
      background-color: rgba($color: #93c7ff, $alpha: 1);
    }
    &-left {
      left: 0px;
      top: 0px;
      height: 100%;
      width: 1px;
      background-image: linear-gradient(
        to bottom,
        rgba($color: #93c7ff, $alpha: 0.25),
        rgba($color: #93c7ff, $alpha: 1)
      );
    }
    &-right {
      top: 0px;
      right: 0px;
      height: 100%;
      width: 1px;
      background-image: linear-gradient(
        to bottom,
        rgba($color: #93c7ff, $alpha: 0.25),
        rgba($color: #93c7ff, $alpha: 1)
      );
    }
  }
}
</style>
